home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.11 Nov 90 / FKEY Source Code / Simple Shell test / selection.c < prev    next >
Encoding:
Text File  |  1989-12-03  |  222 b   |  20 lines  |  [TEXT/KAHL]

  1. Selection( elem, num )
  2.     char    *elem;
  3.     int        num;
  4.     {
  5.     char t;
  6.     int i,j;
  7.     
  8.     for ( i=1; i<num; ++i )
  9.         {
  10.         t = elem[i];
  11.         j = i-1;
  12.         while ( j>=0 && t<elem[j] )
  13.             {
  14.             elem[j+1] = elem[j];
  15.             j--;
  16.             }
  17.         elem[j+1] = t;
  18.         }
  19.     }
  20.